home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Presentations / Presentations ’92 / PatchWorks Kit / MPW Stuff / ProcessVTables < prev    next >
Encoding:
Text File  |  1992-04-27  |  974 b   |  52 lines  |  [TEXT/MPS ]

  1. #
  2. #    ProcessVTables
  3. #    Script to process C++ virtual tables built by CFront.
  4. #
  5. #    by Patrick C. Beard
  6. #
  7. #    Copyright © 1990, 91, 92 by Patrick C. Beard.  All rights reserved.
  8. #
  9.  
  10. Set Echo 0
  11.  
  12. # scan the argument list.
  13.  
  14. Set vtables ""
  15. Set vtoptions ""
  16. Set cpincludes ":"
  17.  
  18. Loop
  19.     Break if {#} == 0
  20.     If "{1}" !~ /-≈/
  21.         Set vtables "{1}"
  22.         Shift 1
  23.         continue
  24.     Else if "{1}" =~ /-i/
  25.         Shift 1
  26.         Set cpincludes "{1}"
  27.         Shift 1
  28.         continue
  29.     Else If "{1}" =~ /-≈/
  30.         Set vtoptions "{1}"
  31.         Shift 1
  32.         continue
  33.     End
  34. End
  35.  
  36. # generate the C code for the virtual tables.
  37.  
  38. CPlus -mf -c -vtbl1 "{vtables}" > __vtables__.c -i "{cpincludes}"
  39.  
  40. # run the resulting code through filters that do what we want.
  41.  
  42. filtertables "{options}" < __vtables__.c > __newvtables__.c
  43. fixtables "{options}"  < __vtables__.c >> __newvtables__.c
  44.  
  45. # compile the results and delete temporary files.
  46.  
  47. C -b -w3 __newvtables__.c -o "{vtables}.o"
  48. delete __vtables__.c
  49. delete __newvtables__.c
  50.  
  51. Unset vtables vtoptions cpincludes
  52.